package mop.model.task.comparator;

import java.util.Comparator;
import mop.model.task.TaskInterface;


/**
 * Compare tasks to each others deadline
 * @author 	MOP Team 7
 */
public class TaskDeadlineComparator implements Comparator<TaskInterface>{

	/**
	 * @see Comparator#compare(Object,Object)
	 * Shortest deadline first
	 */
	@Override
	public int compare(TaskInterface t1, TaskInterface t2) {
		if(t1.getSchedule().getDeadline().getTime() < t2.getSchedule().getDeadline().getTime())
			return -1;
		else if(t1.getSchedule().getDeadline().getTime() == t2.getSchedule().getDeadline().getTime())
			return 0;
		else
			return 1;
	}

}
